

h5file = 'nn/savemodel/lhs_3_size50000_noembed.h5';


num_layer = 3;
nn_weights = cell(num_layer,1);


%% normalize layer
% nn_weights{1}.mean =h5read(h5file,'/normalization_1/mean:0');
% nn_weights{1}.variance =h5read(h5file,'/normalization_1/variance:0');


%% MFP layer


weight_name = '/layer1/layer1/kernel:0';
%bias_name = '/layer1/layer1/bias:0';
nn_weights{1}.weight = h5read(h5file, weight_name);
%nn_weights{1}.bias = h5read(h5file, bias_name);

% 
% weight_name = '/layer2/layer2/kernel:0';
% bias_name = '/layer2/layer2/bias:0';
% nn_weights{2}.weight = h5read(h5file, weight_name);
% nn_weights{2}.bias = h5read(h5file, bias_name);

weight_name = '/layer3/layer3/kernel:0';
% bias_name = '/layer3/layer3/bias:0';
nn_weights{3}.weight = h5read(h5file, weight_name);
% nn_weights{3}.bias = h5read(h5file, bias_name);

save nn_weights.mat nn_weights

%%
load('nn_weights.mat')

%%
net = loadTFLiteModel('nn/savemodel/quantized_model_int8.tflite');